package flc.ast.adapter;

import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import flc.ast.bean.RecordBean;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class RecordAdapter extends StkProviderMultiAdapter<RecordBean> {

    public RecordAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(82));
        addItemProvider(new RecordProvider());
    }

    private class RecordProvider extends BaseItemProvider<RecordBean> {

        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.record_list_item;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, RecordBean recordBean) {
            Glide.with(getContext()).load(recordBean.getPath())
                    .into((ImageView) baseViewHolder.getView(R.id.ivRecordCover));
            baseViewHolder.setText(R.id.tvVideoName, recordBean.getName());
            baseViewHolder.setText(R.id.tvVideoTime, recordBean.getDate());
            baseViewHolder.setText(R.id.tvVideoSize, recordBean.getSize());
        }

    }

}
